﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using PokemonBattle.PokemonData.Util;

namespace PokemonBattle.PokemonData.Rom
{
    public class DataService : DataStream
    {
        public List<Type> Types { get; private set; }
        public List<MoveData> Moves { get; private set; }
        public List<PokemonData> Pokemons { get; private set; }

        #region abstract

        public override void Load(Stream input)
        {
            using (BinaryReader reader = new BinaryReader(input))
            {
                this.Types = DataStreamHelper.ReadList<Type>(reader);
                this.Moves = DataStreamHelper.ReadList<MoveData>(reader);
                this.Pokemons = DataStreamHelper.ReadList<PokemonData>(reader);
            }
        }

        public override void Save(Stream output)
        {
            using (BinaryWriter writer = new BinaryWriter(output))
            {
                this.Types.WriteList(writer);
                this.Moves.WriteList(writer);
                this.Pokemons.WriteList(writer);
            }
        }

        #endregion

    }
}